<script>
  import App from './App'
  import Service from '@/utils/service'
  import { showToast } from '@/utils/index'

  export default {
    config: {
      scene: 1001
    },
    globalData: {

    },
    data() {
      return {
        APPID: 'wx9b954f32b8d2a79c'
      }
    },
    onLaunch(options) {
      console.log(options.scene)
      this.$options.globalData.scene = options.scene;
      let _this = this
      wx.setStorageSync('showNotice', 'true');
      //获取设备信息
      wx.getSystemInfo({
        success: function (res) {
          wx.setStorageSync('systemInfo', res);
        }
      })
    },
    created() {

    },
    methods: {
      getAdCode(data) {
        Service.getAdCode(data).then((res) => {
          if (res.code == 200) {
            wx.setStorageSync('adCode', res.data.adCode);
          }
        })
      },
      jscode2session() {
        let _this = this
        wx.login({
          success: res => {
            // 发送 res.code 到后台换取 openId, sessionKey, unionId
            if (res.code) {
              let data = {code: res.code}
              Service.jscode2session(data).then((res) => {
                if (res) {
                  wx.setStorageSync('session', res);
                }
              })
            }
          }
        })
      }
    }
  }
</script>

<style>

</style>
